// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   JedisUtil.java

package com.itheima.travel.util;

import java.util.ResourceBundle;
import redis.clients.jedis.*;

public final class JedisUtil
{

	private static JedisPool jedilPool;
	private static int maxtotal;
	private static int maxwaitmillis;
	private static String host;
	private static int port;

	private JedisUtil()
	{
	}

	public static Jedis getJedis()
	{
		return jedilPool.getResource();
	}

	public static void close(Jedis jedis)
	{
		if (jedis != null)
			jedis.close();
	}

	static 
	{
		ResourceBundle rb = ResourceBundle.getBundle("jedis");
		maxtotal = Integer.parseInt(rb.getString("maxtotal"));
		maxwaitmillis = Integer.parseInt(rb.getString("maxwaitmillis"));
		host = rb.getString("host");
		port = Integer.parseInt(rb.getString("port"));
		JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
		jedisPoolConfig.setMaxTotal(maxtotal);
		jedisPoolConfig.setMaxWaitMillis(maxwaitmillis);
		jedilPool = new JedisPool(jedisPoolConfig, host, port);
	}
}
